/* Endless Code Copyright (C) 2009 Jingul,Kim
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
 */
package ec.gfx.font;

import java.nio.ByteBuffer;

import ec.gfx.GL;

/**
 * @since 2010
 * @version 1.0
 * @author <a href="mailto:jingul.kim@gmail.com">Jingul,Kim</a>
 */
public class Glyph {
	private char c;
	private int list;
	
	public Glyph(int face, int list, char c) {
		this.c = c;
		this.list = list;
		
		load(face, c);
	}

	public native int getWidth(int face);

	public native int getHeight(int face);
	
	public native int getAdvX(int face);
	
	public native int getAdvY(int face);
	
	public native int getTop(int face);
	
	public native int getLeft(int face);
	
	public int getBottom(int face) {
		return getTop(face) - getHeight(face);
	}
	
	public void load(int face) {
		load(face, c);
	}
	
	public ByteBuffer render(int face) {
		return render(face, c);
	}

	private native void load(int face, char c);
	
	private native ByteBuffer render(int face, char c);
	
	public void render() {
		GL.callList(list);
	}
	
	public char getChar() {
		return c;
	}
}
